package com.hex.liyue.giftmodule.presenter;

import com.hex.liyue.commonmodule.manager.HttpManager;
import com.hex.liyue.commonmodule.manager.UserManager;
import com.hex.liyue.commonmodule.net.ResponseListener;
import com.hex.liyue.commonmodule.utils.L;
import com.hex.liyue.giftmodule.bean.DiscountGiftsBean;
import com.hex.liyue.storemodule.bean.FragmentStoreBean;
import com.hex.liyue.storemodule.presenter.IFragmentStoreView;


/**
 * Created by $cmm on 2016/6/21.
 * <p/>
 * 折现礼物列表的业务类
 */
public class DiscountGiftsPresenter {
    private IDiscountGiftsView iDiscountGiftsView;

    public DiscountGiftsPresenter(IDiscountGiftsView iDiscountGiftsView) {
        this.iDiscountGiftsView = iDiscountGiftsView;
    }

    public void getDiscountGifts(int page,int pagenum) {
        iDiscountGiftsView.showLod("加载中...");
        HttpManager.getInstance().getDiscountGifts(UserManager.getUserId(),page,pagenum, new ResponseListener<DiscountGiftsBean>() {
            @Override
            public void onSuccess(DiscountGiftsBean discountGiftsBean) {
                L.e("discountGiftsBean", discountGiftsBean.toString());
                iDiscountGiftsView.closeLod();
                iDiscountGiftsView.setAdapter(discountGiftsBean);
            }

            @Override
            public void onFailure(String responseresult) {
                iDiscountGiftsView.closeLod();
                iDiscountGiftsView.showT(responseresult);
            }
        });
    }
}
